package cn.tedu.yl.Health_check_up_package.controller;

import cn.tedu.yl.base.response.JsonResult;
import cn.tedu.yl.base.response.PageData;
import cn.tedu.yl.Health_check_up_package.pojo.physical_examination_package;
import cn.tedu.yl.Health_check_up_package.service.physical_examination_packageService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "体检套餐模块")
@RestController
@RequestMapping("/v1/physical_examination_package")
@Slf4j
public class physical_examination_packageController {

    @Autowired
    private physical_examination_packageService departmentService;
    @GetMapping("select")
    public JsonResult getAllArticles() {
        PageData list =departmentService.getAllDepartment();
        return JsonResult.ok(list);
    }

    @PostMapping("create")
    public JsonResult createArticle(@RequestBody physical_examination_package article) {
        log.debug("新增套餐信息，参数:{}",article);
        departmentService.createArticle(article);
        return JsonResult.ok();
    }

    @PutMapping("update/{id}")
    public JsonResult updateArticle(@PathVariable(value = "id") Long id, @RequestBody physical_examination_package articleDetails) {
        log.info("articleDetails:{},id:{}",articleDetails,id);
        departmentService.updateArticle(id, articleDetails);
        return JsonResult.ok();
    }

    @DeleteMapping("delete/{id}")
    public JsonResult deleteArticle(@PathVariable(value = "id") Long id) {
        departmentService.deleteDepartment(id);
        return JsonResult.ok();
    }
}
